package com.csdj.t301.cloud;

import java.io.ObjectStreamClass;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/**
 * author:cloud
 * date:2021/1/21 0021
 **/
public class Charactor01 {
    public static void main(String[] args) {
        try {
            Class clazz = Class.forName("com.csdj.t301.cloud.entity.Person");
            Method method = clazz.getDeclaredMethod("doSomething", String.class);
            Object obj = clazz.newInstance();
            Object target = method.invoke(obj,"someting");
            if( target instanceof  String){
                String str = (String)target;
                System.out.println(str);
            }
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        }

    }
}
